﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace ScanBook
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        //TypeLIb:{94A0E92D-43C0-494E-AC29-FD45948A5221}
        //Interface:HKEY_CLASSES_ROOT\Interface\{03985C95-581B-44D1-9403-8488B347538B}
        private bool IsWIA()
        {
            var key = Microsoft.Win32.RegistryKey.OpenBaseKey(
                        Microsoft.Win32.RegistryHive.ClassesRoot,
                        Microsoft.Win32.RegistryView.Default)
                        .OpenSubKey("Interface")
                //replace with your COM object GUID
                        .OpenSubKey("{03985C95-581B-44D1-9403-8488B347538B}");

            return key != null;
        }



        //            StartupUri="MainWindow.xaml"
        void App_Startup(object sender, StartupEventArgs e)
        {
            if (!IsWIA())
            {
                MessageBox.Show("wiaaut.dll", "ERROR");
                Environment.Exit(1);
            }
            MainWindow mainWindow = new MainWindow();
            mainWindow.Show();
        }

    }
}
